<template>
	<view>
		<view class="listbox" v-for="(item,index) in list" :key="index" @click="todetail(item)">
			<view class="leftbox">
				<image mode="aspectFill" v-if="item.cover_img" :src="item.cover_img"></image>
				<view v-if="item.is_points_gift == 1" style="position: absolute;right: 10rpx;top: 10rpx;padding: 4rpx 10rpx;background-color: #f09a73;color: white;border-radius: 10rpx;font-size: 24rpx;">送积分</view>
			</view>
			<view class="rightbox">
				<view class="namebox">{{item.course_name}}</view>
				<view class="combox">小区: {{item.community_name}}</view>
				<view class="teacher">
					<image mode="aspectFill" v-if="item.avator" :src="item.avator.split(',')[0]"></image>
					<view>老师：{{item.teacher_name}}</view>
				</view>
			</view>
			<!-- <view>{{item.course_name}}</view>
			<view class="catebox">
				<view class="tip">报名截止时间</view>
				<view>{{dateFormat(item.sign_end_time)}}|共{{item.class_hour}}课节</view>
			</view>
			<view class="teacherinfo">
				<view class="heapic">
					<image :src="item.avator.split(',')[0]"></image>
					<view>老师:{{item.teacher_name}}</view>
				</view>
				<view class="but">
					点击报名
				</view>
			</view> -->
		</view>
	</view>
</template>

<script>
	export default {
		name:"goodsclass",
		props:{
			list:{
				type:Array,
				default:[]
			}
		},
		data() {
			return {
				
			};
		},
		methods:{
			dateFormat: function(value) {           
					var date = new Date(value*1000); //时间戳为10位需*1000，时间戳为13位的话不需乘1000
					var year = date.getFullYear();
					var month = ("0" + (date.getMonth() + 1)).slice(-2);
					var sdate = ("0" + date.getDate()).slice(-2);
					var hour = ("0" + date.getHours()).slice(-2);
					var minute = ("0" + date.getMinutes()).slice(-2);
					var second = ("0" + date.getSeconds()).slice(-2);
					// 拼接
					var result = year + "年" + month + "月" + sdate + "日 " + hour + ":" + minute //+ ":" + second;
					// 返回
					return result;
				},
				todetail(item){
					uni.navigateTo({
						url:'/pages/coursesinfo/coursesinfo?id='+item.id
					})
				}
		}
	}
</script>

<style lang="scss" scoped>
	.listbox{
		width: 642rpx;
		height: 208rpx;
		background: #FFFFFF;
		box-shadow: inset 0rpx 4rpx 8rpx 2rpx rgba(245,165,40,0.4);
		border-radius: 20rpx;
		margin: 0 auto 18rpx auto;
		padding: 40rpx 24rpx;
		display: flex;
		align-items: center;
		position: relative;
		.leftbox{
			width: 232rpx;
			text-align: center;
			height: 232rpx;
			position: relative;
			image{
				width: 100%;
				height: 100%;
				border-radius: 10rpx;
			}
		}
		.rightbox{
			width: 390rpx;
			margin-left: 20rpx;
			.namebox{
				-webkit-line-clamp: 2;
				display: -webkit-box;
				-webkit-box-orient: vertical;
				overflow: hidden;
				text-overflow: ellipsis;
				font-size: 36rpx;
				font-family: Source Han Sans CN-Medium, Source Han Sans CN;
				font-weight: 500;
				color: #222222;
			}
			.combox{
				font-size: 28rpx;
				font-family: Source Han Sans CN-Regular, Source Han Sans CN;
				font-weight: 400;
				color: #555555;
				margin-top: 20rpx;
			}
			.teacher{
				display: flex;
				align-items: center;
				margin-top: 20rpx;
				image{
					width: 54rpx;
					height: 54rpx;
					border-radius: 100%;
				}
			}
		}
		.catebox{
			display: flex;
			align-items: center;
			font-size: 28rpx;
			font-family: Source Han Sans CN-Regular, Source Han Sans CN;
			font-weight: 400;
			color: #555555;
			margin-top: 30rpx;
			.tip{
				width: 68rpx;
				height: 38rpx;
				background: linear-gradient(180deg, #FCBB8C 0%, #FF8158 100%);
				border-radius: 4rpx 8rpx 8rpx 8rpx;
				font-size: 28rpx;
				font-family: Source Han Sans CN-Medium, Source Han Sans CN;
				font-weight: 500;
				color: #FFFFFF;
				line-height: 38rpx;
				text-align: center;
				margin-right: 18rpx;
			}
		}
		.teacherinfo{
			display: flex;
			justify-content: space-between;
			align-items: center;
			margin-top: 30rpx;
			.heapic{
				display: flex;
				align-items: center;
				font-size: 28rpx;
				font-family: Source Han Sans CN-Medium, Source Han Sans CN;
				font-weight: 500;
				color: #555555;
				image{
					width: 54rpx;
					height: 54rpx;
					border-radius: 100%;
					margin-right: 18rpx;
				}
			}
			.but{
				width: 210rpx;
				height: 60rpx;
				background: #FF8A9B;
				border-radius: 32rpx;
				font-size: 32rpx;
				font-family: Source Han Sans CN-Medium, Source Han Sans CN;
				font-weight: 500;
				color: #FFFFFF;
				line-height: 60rpx;
				text-align: center;
			}
		}
	}

</style>